export interface UserState {
  avatar: string;
}

// 设置初始数据
// 相当于vuex中的state
const initState: UserState = {
  avatar: 'http://xxx',
};

export default function (state: UserState = initState, action: any) {
  switch (action.type) {
    case 'UPDATE_AVATAR':
      // 假装avatar是请求拿来的
      state = {
        ...state,
        avatar: action.value,
      };
      break;

    default:
      break;
  }
  return state;
}
